---***FIXME: what tags are really needed?

local unitName = "Margan_destroyer"

unitDef = {
name                = "Margan Destroyer",
description         = "The Margan Linebreaker",
objectName          = [[wl_margan_destroyer.s3o]],
script              = [[wl_margan_destroyer_script.lua]],
iconType = "air",

bmcode              = [[1]],

builder             = false,
buildPic            = [[margan_destroyer.png]],
buildTime           = 16000,
canAttack           = true,
maxSlope=100,

----cost
buildCostEnergy     = 18000,
buildCostMetal      = 1800,
----health
maxDamage           = 4650,
AutoHeal        = 4,
----movement
maxVelocity         = 1,
acceleration        = 0.2,
brakeRate           = 3.75,
moverate1           = [[3]],
footprintx          = 6,
footprintZ          = 6,
Upright 			= false,
maneuverleashlength = 1280,
collide             = true,
collision 			= true,
steeringmode        = [[1]],
TEDClass            = [[VTOL]],
turnRate            = 100,
turnRadius		  	= 5,
----aircraft related
canFly              = true,
dontLand		 	= true,
cruiseAlt           = 350,
hoverAttack         = true,
bankingAllowed = false,
airStrafe			= false,
bankscale           = 1,
maxBank				= 0.2,
maxPitch			= 0,

sightDistance       = 800,
canGuard            = true,
canMove             = true,
canPatrol           = true,
canstop             = [[1]],
category            = [[AIR GUNSHIP]],
mass                = 1305,

    ExplodeAs = "LARGE_UNIT_EXPLOSION",

     sfxtypes            = {   
       explosiongenerators = {
--the effects used for EmitSfx in unit script
      "custom:TANKGUN_FX",
      "custom:TANKGUN_FX",
       },
--the effects randomly chosen for flying pieces
      pieceExplosionGenerators =
      {
      "Crashexplosion",
      "Crashexplosion",
      },   
     },


weapons = {
        [1] = {
            def = "CANNON",
	onlyTargetCategory = [[LAND]],
        },
        [2] = {
            def = "FLAK",
	onlyTargetCategory = [[AIR]],
        },
},
}

weaponDefs = {
    CANNON = {
name = "Oblivion cannon",
weapontype = "BeamLaser",
		range = 1400,
		thickness = 5,
		BeamTime = 1,	
		beamDecay = 0.3,	
		intensity = 0.8,
		beamTtl = 1,
		impulsefactor = 0,
        soundstart = "orangeblob_explo",
        soundhit = "orangeblob_explo",
		accuracy = 10,
MinIntensity=1,
		areaofeffect = 75,
		avoidfeature = false,
		avoidfriendly = true,
		canattackground = true,
		collidefriendly = true,		
		reloadtime = 0.1,
		rgbcolor = "0 1 0",
		turret = true,
		texture1 = "greenflame",
		weaponvelocity = 2500,
		explosiongenerator = "custom:greencannonimpact",

		damage =
		{
			default = 350,
		},
	},

    FLAK = {
		name = "Flak Cannons",
		weapontype = "Cannon",
		accuracy = 1000,
burnblow=1,
		areaofeffect = 500,
		avoidfeature = false,
		avoidfriendly = false,
		canattackground = false,
		collidefriendly = false,
		collisionsize = 8,
		commandfire = false,
		craterboost = 0,
		cratermult = 0,
		edgeeffectiveness = 0.1,
		explosionspeed = 256,
		impulseboost = 0,
		impulsefactor = 0,
		intensity = 1,
		noselfdamage = true,
		size = 5,
        soundstart = "flak_fire",
        soundhit = "flak_hit",
		range = 900,
		reloadtime = 0.75,
		rgbcolor = "1.0 1.0 1.0",
		turret = true,
		texture1 = "purpleflame",
		weaponvelocity = 550,
	  myGravity= 0.01,
		explosiongenerator = "custom:FLASH3",
		damage =
		{
			default = 8,
		},
	},
}


unitDef.weaponDefs = weaponDefs
return lowerkeys({ [unitName] = unitDef })


